package demo08.Adapter.iterenum;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * 迭代器适配器
 * */
public class IteratorEnumeration implements Enumeration<Object>{
	Iterator<?> iterator;
	 
	public IteratorEnumeration(Iterator<?> iterator) {
		this.iterator = iterator;
	}
 
	@Override
	public boolean hasMoreElements() {
		return iterator.hasNext();
	}
 
	@Override
	public Object nextElement() {
		return iterator.next();
	}
}
